/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = frfilter.h                                         */
/*  NOTE      =                                                    */
/*  DATE      = 2014/11/10 by guojq                                */
/*******************************************************************/

#ifndef __FRFILTER_H_
#define __FRFILTER_H_

#include "frlist.h"

#define FILTER_PROTO_ANY   0

Frlist_header *apm_get_filter_list(void);

int apm_add_filter(int i_action, unsigned char arr_mac[APM_MAC_SIZE], u_short us_proto
              , u_int src_ip_start, u_int src_ip_end, u_int dst_ip_start, u_int dst_ip_end
              , u_short src_port_start, u_short src_port_end, u_short dst_port_start, u_short dst_port_end);

void apm_filter_remove_all(void);
int apm_do_filter(unsigned char arr_mac[APM_MAC_SIZE], u_short us_proto
             , u_int src_ip, u_int dst_ip, u_short src_port, u_short dst_port, int i_default_action);
int apm_filter_load(void);
int apm_filter_init(void);
void apm_filter_destroy(void);

int apm_prepare_add(int i_action, char *p_mac, u_short us_proto
              , char *p_src_ip, char *p_dst_ip, char *p_sport, char *p_dport);
int apm_prepare_del(char *p_mac, u_short us_proto
                  , char *p_src_ip, char *p_dst_ip, char *p_sport, char *p_dport);
int apm_filter_show(char **pp_out);
void apm_filter_commit(void);
void apm_filter_rollback(void);
void apm_filter_clear(void);

#endif
